package com.design;

import com.design.event.FireEvent;
import com.design.observer.BaoAnObserver;
import com.design.subject.CenterSubject;

/**
 * @Author: BuYee
 * @Date: 2022/8/24
 */
public class ObserverStarter {
    public static void main(String[] args) {
        CenterSubject centerSubject = new CenterSubject();
        BaoAnObserver baoAn1 = new BaoAnObserver("小张", 1);
        BaoAnObserver baoAn2 = new BaoAnObserver("小里", 2);
        BaoAnObserver baoAn3 = new BaoAnObserver("小王", 3);

        centerSubject.addObserver(baoAn1);
        centerSubject.addObserver(baoAn2);
        centerSubject.addObserver(baoAn3);

        FireEvent event = new FireEvent("火灾", 2);
        centerSubject.publishEvent(event);
    }
}
